package cn.gson.crm.controller.interview;

import cn.gson.crm.controller.BaseServlet;
import cn.gson.crm.model.dao.AccessoryDao;
import cn.gson.crm.model.entity.Accessory;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class AccessoryInfoServlet
 */
@WebServlet("/accessory/info")
public class AccessoryInfoServlet extends BaseServlet {
	private static final long serialVersionUID = 1L;
	private AccessoryDao ad = new AccessoryDao();

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void get(HttpServletRequest request, HttpServletResponse response) throws Exception {
		String record  = request.getParameter("record");
		String model  = request.getParameter("model");
		
		List<Accessory> listA = ad.getAllAccessoryByModelAndRecord(Integer.parseInt(record), model);
		request.setAttribute("listA", listA);
		forward("interview/accessory_info.jsp");
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void post(HttpServletRequest request, HttpServletResponse response) throws Exception {
		
		
	}

}
